home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-04 / tm480.zip / TMISSUE.EXE / SMART.TSK < prev    next >
Text File  |  1991-09-10  |  14KB  |  534 lines

  1. ; Title   : SMART.TSK                   Last Updated : July 24, 1991
  2. ; Author  : Steve Johnson - FmP.        Version      : 1.20
  3. ; Purpose : User oriented menu interfaced to EUC
  4. ; Notes   : Uses SAVE and RESTORE to file called SMART.TM
  5. ;           The task validates usernames and passwords against EUC
  6. ;           catalogue. Allows a "standard" list of applications to
  7. ;           be edited.
  8. ;           Task screen output is to screen 1, Application O/P to 0.
  9. ; Latest  : Support for networking revised.
  10.  
  11. int column
  12. int count
  13. int i
  14. int line
  15. int ug
  16.  
  17. logical auto
  18. logical forever
  19. logical save_reqd
  20.  
  21. vconst cls,11
  22. vconst cel,55
  23. vconst cep,56
  24.  
  25. var char,1
  26. var descriptions,15,occurs 7,
  27. 'On-line Manual '
  28. 'SCR manual     '
  29. 'Database       '
  30. 'File Transfer  '
  31. 'Leisure ware   '
  32. 'Development    '
  33. 'Wordprocessing '
  34.  
  35. var fmpdir,64,$fmpdir
  36. var fmpcat,64,$fmpcat
  37. var loginpath,64
  38. var login_error,32,'Invalid login - please retry...'
  39. var null,1
  40. var pass,16
  41. var screen_line,80
  42. var tme,4
  43. var uname,16
  44.  
  45. var path,20
  46. var paths,20,occurs 7,
  47. ".                   "
  48. ".                   "
  49. ".                   "
  50. ".                   "
  51. "\flsim              "
  52. ".                   "
  53. ".                   "
  54.  
  55. èvar parameter,20
  56. var parameters,20,occurs 7,
  57. "TMMAN               "
  58. "SCRMAN              "
  59. "                    "
  60. "                    "
  61. "                    "
  62. "TMDEV               "
  63. "WORDPROC            "
  64.  
  65. var program,8,"   SMART"
  66. var programs,8,occurs 7,
  67. "TM      "
  68. "TM      "
  69. "PROTEAN "
  70. "XPORT   "
  71. "fs3     "
  72. "TM      "
  73. "TM      "
  74.  
  75.  
  76. end
  77. lookfor "smart.ovr"
  78. if not found
  79.   forms logon.ovr       ;in case /q and not registered
  80.   insert program program
  81.   put "NO_FORMS"
  82.   stop
  83. fi
  84. display cls
  85. screen 1
  86. display cls
  87. screen 0
  88. if colour
  89.   screen 1
  90.   switch 1
  91. fi
  92. forms smart.ovr
  93. user loginpath      ;Save initial directory
  94.  
  95. restore 'smart.tm' descriptions programs paths parameters
  96. if resp ne 0
  97.   if not colour
  98.     clear count
  99.     until count = 7
  100.       if entry count of programs = "TM      "
  101.     move "TM /m   " to entry count of programs
  102.       fi
  103.     fi count
  104.   fi
  105.   save 'smart.tm' descriptions programs paths parameters
  106.   if resp ne 0
  107.     wait 'SMART: Unable to save data to SMART.TM'
  108.     stop
  109.   fiè  save
  110. else
  111.   restore
  112. fi
  113. if fmpcat = null
  114.   if fmpdir = null
  115.     move '\fmp' to fmpdir
  116.   fi
  117. else
  118.   move fmpcat to fmpdir
  119. fi
  120. dir fmpdi≥ '\º catalog.euc
  121. if not found
  122.   put "NO_CATALOGUE"
  123.   screen 0
  124.   switch 0
  125.   stop
  126. fi
  127. catalog fmpdi≥ ;open the catalog ready for use
  128. if resp ne 0
  129.   displayln "Unable to opeε thσ cataloguσ iε directory: " fmpdir 
  130.   wait
  131.   stop
  132. fi
  133. until forever
  134.   display cls
  135.   move 1 to resp
  136.   until resp = 0 or auto
  137.     put 'LOG' noclear
  138.     CLEAR uname
  139.     get uname pass
  140.     if funkey = 10
  141.       put "EGRESS"
  142.       get forever
  143.       if forever
  144.     screen 0
  145.     switch 0
  146.     stop
  147.       fi
  148.       move 1 to resp
  149.     else
  150.       if fk1
  151.     put "DUMMY_CAT" wait 0 noclearè    move 1 to resp
  152.       else
  153.     login uname pass ug
  154.         if resp = 3
  155.           cursor 12 10 'User ' uname ' already logged-in'
  156.         else
  157.           if resp <> 0
  158.           put "DUMMY_CAT" wait 0 noclear
  159.         insert login_error
  160.         move 1 to resp
  161.         fi
  162.     fi
  163.       fi
  164.     fi
  165.   fi
  166.   move 0e040h to bbmask
  167.   display cls
  168.   userline 'Current user is ' uname
  169.   move 10 to timer
  170.   menu 1,'SERVICES',descriptions
  171.   option 1,1,7
  172.     if choice = 5
  173.       move time to tme
  174.       if tme > '12:0' and tme < '13:3' or tme > '17:3' or tme < '08:3'
  175.       else
  176.     cursor 18 0 "This is COMPANY TIME - games available "
  177.     display "noon > 1:30 and after 5:30 p.m."
  178.     cursor 19 0 "Please try later " UNAME 2
  179.     wait
  180.     cursor 18 0 cel
  181.     cursor 19 0 cel
  182.     if keyval = 'O'   ;Press O to override time check...
  183.     else
  184.       return
  185.     fi
  186.       fi
  187.     fi
  188.     move choice to i
  189.     decrement i
  190.     move entry i of programs to program
  191.     if program = spaces
  192.       display 5 "No details yet supplied"
  193.       move 8 to choice
  194.       return
  195.     else
  196.       move entry i of paths      to path
  197.       move entry i of parameters to parameter
  198.       if parameter ct '?'
  199.     insert program
  200.     fieldfill parameter
  201.     put "EDIT_PAR" noclear
  202.     get parameter
  203.       fi
  204.     fi
  205.     trim path
  206.     if path ne spaces and path ne '.'
  207.       if path sw '~:\'
  208.         select path
  209.       fi
  210.       user path
  211.       if resp ne 0
  212.     cursor 0 0 'Unable to select specified path - abandoned'è    return
  213.       fi
  214.     fi
  215.     if colour
  216.       screen 0
  217.       userline 'Attempting to run application in screen number zero..'
  218.       switch 0
  219.     fi
  220.     display cls
  221.     trim program parameter
  222.     run program 1 parameter
  223.     if colour
  224.       switch 1
  225.       screen 1
  226.     fi
  227.     select loginpath
  228.     display cls  ;in case app overwrote it!
  229.     userline 'Current user is ' uname
  230.     user loginpath
  231.     return
  232.  
  233.   option 1,8
  234.     if ug ne 99
  235.       cursor 17 0 "Please login as user in group 99 to amend list"
  236.       cursor 18 0
  237.       wait
  238.       cursor 17 0 cel
  239.       cursor 18 0 cel
  240.       move 10 to choice
  241.       return
  242.     fi
  243.     clear count save_reqd
  244.     until count = 7 or fk2
  245.       fieldfill entry count of descriptions
  246.       fieldfill entry count of programs
  247.       fieldfill entry count of paths
  248.       fieldfill entry count of parameters
  249.       put application_detail noclear
  250.       get entry count of descriptions
  251.       get entry count of programs
  252.       get entry count of paths
  253.       get entry count of parameters
  254.       if not anyfk
  255.     move true to save_reqd
  256.       fi
  257.     fi count
  258.     if save_reqd
  259.       user loginpath
  260.       save 'smart.tm' descriptions programs paths parameters
  261.       if resp ne 0
  262.         wait 'SMART: Unable to save data to SMART.TM'
  263.         stop
  264.       fi
  265.       save
  266.     fiè    cursor 17 0 cep
  267.     put "CLEAR" wait 0 noclear
  268.     return
  269.  
  270.   option 1,9
  271.     put 'NEWPASS' noclear ul ''
  272.     display cls
  273.     if funkey = 10
  274.       return
  275.     else
  276.       get pass
  277.       password pass
  278.     fi
  279.     return
  280.  
  281.   option 1,10
  282.   option 1,30
  283.     logout
  284.     clear auto
  285.     exitm
  286.   option 1,31
  287.     put 'HELPSCREEN'
  288.     move hilite to choice
  289.     return
  290.   option 1,32
  291.     put 'HELPSWITCH'
  292.     move hilite to choice
  293.     return
  294.   option 1,39
  295.     if colour
  296.       SCREEN 0
  297.       userline 'Contents of page 0...Press any key'
  298.       switch 0
  299.       inkey char
  300.       if colour
  301.     screen 1
  302.     switch 1
  303.       fi
  304.     else
  305.       userline "F9 key is not applicable on mono monitors"
  306.     fi
  307.     move hilite to choice
  308.     clear bbdisp
  309.     return
  310.   option 1,99
  311.     move hilite to choice
  312.     increment choice
  313.     move true to auto
  314.     exitm
  315.   endm 1
  316. fi
  317.  
  318. endtask
  319.  
  320. @VIDEOè@HEAD LEFT,'Taskmaster Example'
  321. @HEAD RIGHT,'EUC Controlled Access'
  322. @HEAD centre,'User Login'
  323. @NF LOG
  324. @acceptfk f1,f10
  325. @window line0,column0,depth1,width1
  326. @col char,cyan,blue
  327. @bright
  328. @banner
  329. @COL CHAR,YELLOW,BLACK
  330. @DRAW
  331. @STR MIN1
  332. @STR
  333. >Y<
  334.   Entry to this application is controlled by EUC,
  335.   the Taskmaster END USER COMPUTING Facility
  336.   F1 for Username list. Press F10 to quit.
  337.   >A<
  338.  
  339.            USERNAME [guest           ]
  340.            PASSWORD [!               ]
  341.         {                                }
  342.                                              >A<
  343.                                                 >Y<
  344. @COL CHAR,YELLOW,BLACK
  345. @END
  346. @NF SERVICES
  347. @acceptfk f1,f2,f9
  348. @window line0,column0,depth1,width1
  349. @HEAD centre,'Service Selection'
  350. @col char,cyan,blue
  351. @banner
  352. @BBMENU WHITE,BLUE
  353. @wINDOW LINE 2,COLUMN 30,DEPTH 14,WIDTH 18
  354. @GON
  355. 7----------------9
  356. 0APPLICATIONS:   0
  357. 0{Archives       }0
  358. 0{Comms          }0
  359. 0{Database       }0
  360. 0{File Transfer  }0
  361. 0{Leisure ware   }0
  362. 0{Spreadsheet    }0
  363. 0{Wordprocessor  }0
  364. 0FUNCTIONS:      0
  365. 0{Edit Apps List }0
  366. 0{Change Password}0
  367. 0{Logout (+Quit) }0
  368. 1----------------3
  369. @goff
  370. @colour char,cyan,BLUE
  371. @window line20,column18,depth2,width 42
  372.   F1 or F2 for Help.
  373.   F9 to view output from last application.
  374. @ENDè@NF clear
  375. @wINDOW LINE 2,COLUMN 50,DEPTH 14,WIDTH 25
  376. @end
  377.  
  378. @NF NEWPASS
  379. @acceptfk f10
  380. @window line0,column0,depth1,width1
  381. @bright
  382. @COL CHAR,YELLOW,BLUE
  383. @STR
  384. @WINDOW LINE 16,COLUMN 17,DEPTH 8,WIDTH 46,pattern 176
  385.  
  386.  
  387.      NEW PASSWORD ?  [                ]
  388.  
  389. @colour char,red,black
  390.  
  391.         Press F10 to Abandon change
  392. @END
  393. @nf APPLICATION_DETAIL
  394. @acceptfk f1,f2
  395. @STR MIN1
  396. @STR MIN1
  397. @path
  398. @STR
  399. @WINDOW LINE 17,COLUMN 0,DEPTH 5,WIDTH 80
  400. @dim
  401. @GON
  402. 7-Edit-and-press-<>-to-update-application-list:--(use--to-move)-------9
  403. 0 Description for menu    [               ]                                   0
  404. 0 Application name        [        ] Exclude .xxx (COM,EXE or BAT is implied) 0
  405. 0 Working Directory       [.                   ] Note: a FULL STOP = current  0
  406. 0 Command line Parameters [                    ] Optional: ? = prompt user    0
  407. 4-----------------------------------------------------------------------------6
  408. 1-----Press F1 to skip to next. Press F2 to skip remainder--------------------3
  409. @bright
  410. @END
  411. @nf helpscreen
  412. @head centre,"General help"
  413. @colour char,cyan,BLUE
  414. @banner
  415. @colour char,cyan,BLack
  416. @draw
  417. @colour char,cyan,black
  418.   >1<
  419.         This  application is user-configurable allowing the user to  fill
  420.         in details of a list of up to seven applications.
  421.  
  422.         The  task demonstrates the use of the SAVE and RESTORE  commands,
  423.         used here to remember details of the applications.
  424.  
  425.         The  task  also  makes  use of the  SWITCH  and  SCREEN  commands
  426.         allowing output from the applications to remain on the screen and
  427.         be  accessible  by use of the F9 key. THIS IS NOT  DONE  ON  MONO
  428.         VIDEOS.è
  429.         Please note that the leisureware option is only available between
  430.         certain specified times showing use of the TIME system variable.
  431.  
  432.         The menu has been made to TIME-OUT after 10 seconds automatically
  433.         selecting the next topic.
  434.                                                                            >1<
  435. @end
  436. @nf helpswitch
  437. @head centre,"Help on screen switching"
  438. @colour char,cyan,BLUE
  439. @banner
  440. @draw
  441. @colour char,cyan,black
  442. >1<
  443.    Typical  MS-DOS  CGA video adaptors maintain 4 separate pages  of  screen
  444.    memory and Taskmaster is able to switch between them.  This task  assumes
  445.    that if the video is not colour it has only one page.
  446.  
  447.    Many   applications  write  directly  to the  first  of   these   screens
  448.    (directly  to the hardware); because of this behaviour,  this  particular
  449.    task  arranges to use screen  1  (the  second screen) for all its  normal
  450.    output (if CGA or above).
  451.  
  452.    Having  adopted  this approach the F9 key has  been  utilised  to display
  453.    the   contents of screen 0 (which normally  contains  the output  of  the
  454.    last command issued).
  455.  
  456.    Incidentlly  using  Taskmaster  one  may write to   a   screen  which  is
  457.    currently not being displayed.
  458.                                                                              >1<
  459.  
  460.    In  a secure task, exit to the System prompt can be prevented.   To  exit
  461.    this task logout and press F10 at the login screen.  Note that Taskmaster
  462.    can disable Control/break and Control/C keys if required.
  463. @end
  464. @nf egress
  465. @acceptfk none
  466. @log
  467. @head centre,"Exit from SMART task"
  468. @colour char,cyan,BLUE
  469. @banner
  470. @draw
  471. @colour char,cyan,black
  472. >1<
  473.    To  maintain  a  secure installation the ability to exit  to  the  system
  474.    prompt  would  need  to be restricted to certain users,   or  members  of
  475.    specified  user  groups; but as this is just a demo you may leave.
  476.  
  477. @bright
  478.                  Do you want to exit SMART.TSK ? [Y]
  479.                                                                              >1<
  480. @end
  481. @nf NO_CATALOGUE
  482. @dimè   SMART.TSK error: Cannot locate/read the catalogue file maintained by EUC.
  483.  
  484.    If you have EUC (Not supplied with the Shareware version):  Please run it
  485.    to set up a catalogue in the current working directory.
  486.  
  487.    If  you  don't have EUC: A file named CALALOG.EUC is  supplied  with  all
  488.    Taskmaster  issues,  you will not be able to edit the  catalogue  without
  489.    EUC  but you will be able to use the dummy names catalogued within it  to
  490.    run those applications that are interfaced to EUC  (for example SMART.TSK
  491.    and CONFIG/STANDARD).
  492.  
  493.    During use the catalogue is updated by Taskmaster, recording  details  of
  494.    users, dates and times of login and logout, name of last  menu  used  the
  495.    option  selected  etc.  CATALOGV.EUC is an exact copy of  CATALOG.EUC  as
  496.    issued.
  497. @end
  498. @nf DUMMY_CAT
  499. @WINDOW LINE 2,COLUMN 51,DEPTH 1,WIDTH0
  500. @dim
  501. The dummy catalogue contains
  502. these  names, passwords  and
  503. group numbers:
  504. @gon
  505. 7-------8----------8-------9
  506. 0 Name  0 Password 0 group 0
  507. 4-------5----------5-------6
  508. 0 guest 0          0  10   0
  509. 0 Bill  0 Access   0  20   0
  510. 0 Phil  0 Secret   0  30   0
  511. 0 Joan  0 a1b2c3   0  99   0
  512. 0 ADMIN 0 FMP      0  99   0
  513. 1-------2----------2-------3
  514. "UPPER" and "lower" case are
  515. NOT  considered the same  in
  516. usernames and passwords.
  517.  
  518. Once   logged  in  you   may
  519. change the password.  If you
  520. do then only you and the EUC
  521. administrator will know it!
  522. You may copy CATALOGV.EUC to
  523. CATALOG.EUC to restore them.
  524. @end
  525. @nf edit_par
  526. @acceptfk none
  527. @str
  528. @window line20,column 10,depth3,width60
  529.  
  530.   Please edit parameters for {        } [                    ]
  531. @end
  532. @eof
  533.  
  534.